﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CentersUsage.aspx.cs" Inherits="Charts_Pie_CentersUsage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="Server">
    <section class="featured">
        <div class="content-wrapper" dir="rtl">
            مقایسه مصرف انرژی مراکز
        </div>
    </section>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="Server">
    <script lang="jv" type="text/javascript">
        function SelectItem(sender, e) {
            e.IsValid = (e.Value != '0');
        }
    </script>
    <div dir="rtl" style="width: 100%;">
        <table>
            <tr>
                <td style="width: 100px;">نوع انرژی:</td>
                <td style="width: 100px;">
                    <asp:DropDownList ID="TypeDropDownList" runat="server" DataSourceID="ConstantEntityDataSource"
                        DataTextField="ConstantName" DataValueField="ConstantValue" Height="22px" Width="128px">
                    </asp:DropDownList>
                    <asp:CustomValidator ID="TypeCustomValidator" runat="server" ClientValidationFunction="SelectItem"
                        ControlToValidate="TypeDropDownList" Display="Dynamic" ErrorMessage="*" ValidateEmptyText="True"></asp:CustomValidator>
                </td>
                <td style="width: 100px;">&nbsp;&nbsp;&nbsp; تاریخ:</td>
                <td style="width: 100px;">
                    <pdc:PersianDateTextBox ID="DatePersianDateTextBox" runat="server" PickerDirection="ToRight" ShowPickerOnTop="True" Width="117px"></pdc:PersianDateTextBox>
                    <asp:RequiredFieldValidator ID="PersianDateRequiredFieldValidator" runat="server" ControlToValidate="DatePersianDateTextBox"
                        Display="Dynamic" ErrorMessage="*"></asp:RequiredFieldValidator>
                </td>
                <td style="width: 100px;"></td>
                <td style="width: 100px;">
                    <asp:LinkButton ID="ChartLinkButton" runat="server" OnClick="ChartLinkButton_Click" Text="گزارش" CssClass="button" ValidationGroup="Chart" />
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    <asp:CheckBoxList ID="CenterCheckBoxList" TextAlign="Right" runat="server" DataSourceID="CenterEntityDataSource" DataTextField="Name" DataValueField="ID" >
                    </asp:CheckBoxList></td>
                <td colspan="3">
                    <asp:Chart ID="Chart1" runat="server" Height="300px" Width="400px">
                        <Titles>
                            <asp:Title ShadowOffset="3" Name="Title1" />
                        </Titles>
                        <Legends>
                            <asp:Legend Alignment="Center" Docking="Bottom" IsTextAutoFit="False" Name="Default" LegendStyle="Row" />
                        </Legends>
                        <Series>
                            <asp:Series Name="Default" />
                        </Series>
                        <ChartAreas>
                            <asp:ChartArea Name="ChartArea1" BorderWidth="0" />
                        </ChartAreas>
                    </asp:Chart>
                </td>
            </tr>
        </table>
    </div>
    <br />
    
    <asp:HiddenField ID="CenterIDHiddenField" runat="server" />
    <asp:SqlDataSource ID="CentersUsageSqlDataSource" runat="server" ConnectionString='<%$ ConnectionStrings:ICTBillingConnectionString %>' SelectCommand="spCentersUsage_pie" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:ControlParameter ControlID="CenterIDHiddenField" DbType="String" Name="CenterID" PropertyName="Value" DefaultValue="" />
            <asp:ControlParameter ControlID="DatePersianDateTextBox" PropertyName="DateValue" Name="Date" Type="DateTime"></asp:ControlParameter>
            <asp:ControlParameter ControlID="TypeDropDownList" PropertyName="SelectedValue" Name="Type" Type="Byte"></asp:ControlParameter>
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:EntityDataSource ID="CenterEntityDataSource" runat="server" ConnectionString="name=ICTBillingEntities" DefaultContainerName="ICTBillingEntities"
        EnableFlattening="False"
        CommandText="(SELECT  it.[PkCenterID] As ID, it.[CenterName] As Name FROM ICTBillingEntities.tbCenters AS it)">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="ConstantEntityDataSource" runat="server" ConnectionString="name=ICTBillingEntities" DefaultContainerName="ICTBillingEntities"
        EnableFlattening="False"
        CommandText="(SELECT x.[ConstantValue],x.[ConstantName]  from ICTBillingEntities.tbConstants as x where (x.[PkConstantID] = 2 || x.[FatherID] = 3))"
        EntityTypeFilter="" Select="">
    </asp:EntityDataSource>
    <pdc:PersianDateScriptManager ID="PersianDateScriptManager" runat="server">
    </pdc:PersianDateScriptManager>
</asp:Content>

